#include <cstdio>
#include <iostream>
#include <string>
using namespace std;

int main(int argc, char const* argv[])
{
    int n;
    while (cin >> n && n != 0) {
        for (int j = 0; j < n; j++) {
            string input;
            cin >> input;
            int count = 0;
            int t = input.find('\\', 0);
            while (t != string::npos) {
                for (int i = 0; i < count; i++)
                    cout << "  ";
                cout << input.substr(0, t) << endl;
                input.erase(0, t + 1);
                t = input.find('\\', 0);
                count++;
            }
            if (input.size() != 0) {
                for (int i = 0; i < count; i++)
                    cout << "  ";
                cout << input << endl;
            }
        }
    }
    return 0;
}
